import React from "react"
import "./toggle.css"
let el1 = <h1>请充值，开启你的狂暴之路</h1>
let el2 = <h1>欢迎回家，尊敬的王者玩家</h1>
class Toggle extends React.Component {
    state = {
        isOk: false
    }
    handleClick=()=> {
        this.setState({
            isOk: !this.state.isOk
        })
    }
    render() {
        let {isOk}=this.state
        return (
            <fieldset>
                <legend>toggle案例</legend>
                <div className="box">
                    {isOk ? el2 : el1}
                </div>
                <button onClick={this.handleClick}>{isOk?"点击撤退":"点击充值"}</button>
            </fieldset>
        )
    }
}
export default Toggle